<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>3424：Poi2013 Multidrink</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">Poi2013 Multidrink</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">Poi2013 Multidrink</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                Poi2013 Multidrink                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：256MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p style="background: white; line-height: 13.5pt"><span style="font-size: medium;"><span lang="EN-US" style="color: rgb(68, 68, 68); font-family: Tahoma;">Byteasar lives in Byteburg, a city famous for its milk bars on every corner. One day Byteasar came up with an idea of a &quot;milk multidrink&quot;: he wants to visit each milk bar for a drink exactly once. Ideally, Byteasar would like to come up with a route such that the next bar is always no further than two blocks (precisely: intersections) away from the previous one.</span></span><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体"><font size="3"><o:p></o:p></font></span></p>
<p style="background: white; line-height: 13.5pt"><span style="font-size: medium;"><span lang="EN-US" style="color: rgb(68, 68, 68); font-family: Tahoma;">The intersections in Byteburg are numbered from<span class="apple-converted-space">&nbsp;</span>1<span class="apple-converted-space">&nbsp;</span>to<span class="apple-converted-space">&nbsp;</span>N, and all the streets are bidirectional. Between each pair of intersections there is a unique direct route, ie, one that does not visit any intersection twice. Byteasar begins at the intersection no.<span class="apple-converted-space">&nbsp;</span>1<span class="apple-converted-space">&nbsp;</span>and finishes at the intersection no.<span class="apple-converted-space">&nbsp;</span>N.</span></span><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体"><font size="3"><o:p></o:p></font></span></p>
<p style="background: white; line-height: 13.5pt"><span style="font-size: medium;"><span lang="EN-US" style="color: rgb(68, 68, 68); font-family: Tahoma;">Your task is to find any route that satisfies Byteasar's requirements if such a route exists.</span></span><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体"><font size="3"><o:p></o:p></font></span></p>
<p><span style="font-size: medium;">&nbsp;<img width="392" height="531" src="../file/3424_0.jpg" alt="" /></span></p>
<pre><span style="font-size: medium;">给一棵树，输出遍历序列a[]，要求每个节点被访问到到恰好一次  要求从1号节点出发，结束在n号节点 要求对于所有i,a[i]与a[i+1]的距离 小于等于2 </span></pre>
<p><span style="font-size: medium;"><br />
</span></p></p><hr/><h3>输入格式</h3><p><p style="background: white; line-height: 13.5pt"><span style="font-size: medium"><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体">In the first line of the standard input there is a single integer<span class="apple-converted-space">&nbsp;</span>N(2&lt;=N&lt;=500000)<span class="apple-converted-space">&nbsp;</span>, denoting the number of intersections in Byteburg. Each of the following<span class="apple-converted-space">&nbsp;</span>N-1<span class="apple-converted-space">&nbsp;</span>lines holds a pair of distinct integers<span class="apple-converted-space">&nbsp;</span>Ai<span class="apple-converted-space">&nbsp;</span>and<span class="apple-converted-space">&nbsp;</span>Bi(1&lt;=Ai,Bi&lt;=N)<span class="apple-converted-space">&nbsp;</span> separated by a single space, that represent the street linking the intersections no.<span class="apple-converted-space">&nbsp;</span>Ai<span class="apple-converted-space">&nbsp;</span>and<span class="apple-converted-space">&nbsp;</span>Bi.</span></span><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体"><font size="3"><o:p></o:p></font></span></p></p><hr/><h3>输出格式</h3><p><p style="background: white; line-height: 15.05pt"><span style="font-size: medium"><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体">If there is no route satisfying Byteasar's requirements, your program should print a single word &quot;</span><tt><span lang="EN-US" style="color: #444444"><font face="宋体">BRAK</font></span></tt><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体">&quot; (Polish for<span class="apple-converted-space">&nbsp;</span><i>none</i>), without the quotation marks to the standard output. Otherwise, your program should print<span class="apple-converted-space">&nbsp;</span>N<span class="apple-converted-space">&nbsp;</span>lines to the standard output, the i-th of which should contain the number of the<span class="apple-converted-space">&nbsp;</span>i-th intersection on an arbitrary route satisfying Byteasar's requirements. Obviously, in that case the first line should hold the number<span class="apple-converted-space">&nbsp;</span>1, and the<span class="apple-converted-space">&nbsp;</span>N-th line - number<span class="apple-converted-space">&nbsp;</span>N.</span></span><font size="3"><span lang="EN-US" style="color: #444444; font-family: Tahoma; mso-bidi-font-family: 宋体"><o:p></o:p></span></font></p></p><hr/><h3>样例输入</h3><pre>12
1 7
7 8
7 11
7 2
2 4
4 10
2 5
5 9
2 6
3 6
3 12
</pre><hr/><h3>样例输出</h3><pre>1
11
8
7
4
10
2
9
5
6
3
12
</pre><hr/><h3>提示</h3><p>没有写明提示</p><hr/><h3>题目来源</h3><p>鸣谢Wcmg提供SPJ 译文</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=3424" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=3424" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>